2-add-two-numbers.py
problem: ---
problem:

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order 
and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.

Example:
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
Explanation: 342 + 465 = 807.
---

-----------------------------------------------------------------------
bug_fixes: ---
bug_fixes:
Replace `nodes_sum = None` with `nodes_sum = 0` on line 4.
Replace `cur.next = ListNode(nodes_sum / 10)` with `cur.next = ListNode(nodes_sum % 10)` on line 12.
Replace `l2 - l2.next` to `l2 = l2.next` on line 11.
---

-----------------------------------------------------------------------
bug_desc: ---
bug_desc:
On line 4, nodes_sum is set to None, which means it is not an integer but, it is treated as an integer. This results in a runtime error. Therefore, nodes_sum should be set to 0.
On line 12, nodes_sum is divided by 10, which disrupts the carry logic, and sets the wrong value in place. Therefore, the division operation must be changes to a modulo operation.
On line 11, l2.next is subtracted from l2. This is a syntactical mistake, where the subtraction symbol should be the equate symbol. The line should read `l2 = l2.next`.
---

-----------------------------------------------------------------------
line_no: ---
line_no:
4
---

-----------------------------------------------------------------------
buggy_code: ---
buggy_code:
1. class Solution:
2.     def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
3.       res = cur = ListNode(0)
4.       nodes_sum = None
5.       while l1 or l2 or nodes_sum:
6.         if l1:
7.           nodes_sum += l1.val
8.           l1 = l1.next
9.         if l2:
10.           nodes_sum += l2.val
11.           l2 - l2.next
12.         cur.next = ListNode(nodes_sum / 10)
13.         cur = cur.next
14.         nodes_sum //= 10
15.       return res.next
16. 
---

-----------------------------------------------------------------------
correct_code: ---
correct_code:
1. class Solution:
2.     def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
3.       res = cur = ListNode(0)
4.       nodes_sum = 0
5.       while l1 or l2 or nodes_sum:
6.         if l1:
7.           nodes_sum += l1.val
8.           l1 = l1.next
9.         if l2:
10.           nodes_sum += l2.val
11.           l2 = l2.next
12.         cur.next = ListNode(nodes_sum % 10)
13.         cur = cur.next
14.         nodes_sum //= 10
15.       return res.next
16. 
---

-----------------------------------------------------------------------
